//
// Created by isaac on 18-9-11.
//

#ifndef ONLINE_MALICIOUS_TRAFFIC_DETECTION_VALUES_H
#define ONLINE_MALICIOUS_TRAFFIC_DETECTION_VALUES_H


#include <sys/types.h>

/* the list in struct Features are corresponding to different values
 * the following value lists are formatted as network byte order which is inverse compared with host byte order
 * this makes the list in struct Features more effective to fill
 */
//u_short tls_version_list[] = {0x0003, 0x0103, 0x0203, 0x0303};
//
//u_short cipher_suite_list_ob[] = {
//        0x9d00,0x7bc0,0x3500,0x2a2a,0xfffe,0x1bc0,0x0900,0x1fc0,
//        0x6600,0x3e00,0x7ac0,0x3600,0x04c0,0x13c0,0x6400,0xdada,
//        0x3900,0x21c0,0x26c0,0x0113,0x0000,0x13cc,0x30c0,0x9c00,
//        0x05c0,0x03c0,0x8600,0x9a00,0xc300,0x6800,0x1a1a,0x02c0,
//        0x8a8a,0x6700,0xa400,0x9f00,0x0a00,0x1100,0x3100,0x2dc0,
//        0x4100,0xa100,0xbaba,0x15cc,0x1500,0x8500,0x86c0,0x14cc,
//        0x1ec0,0x9900,0x3200,0x24c0,0x4400,0x81c0,0x09c0,0x3700,
//        0xfafa,0x0313,0xbe00,0x0800,0xaaaa,0x0400,0x0f00,0x6300,
//        0x1200,0x14c0,0x1600,0x8bc0,0x9800,0x25c0,0x2cc0,0x77c0,
//        0x3000,0x3300,0x07c0,0x0300,0x4a4a,0x6200,0x08c0,0x87c0,
//        0x7a7a,0x4000,0x80c0,0x76c0,0x8ac0,0x9700,0xc000,0x6a00,
//        0x0c00,0x2ac0,0x8400,0x8700,0x6a6a,0xc400,0x0500,0x1400,
//        0x0600,0x9e00,0x11c0,0x6b00,0x0213,0x6900,0xa8cc,0xa300,
//        0x0fc0,0x3f00,0xa200,0x73c0,0xa000,0x4300,0x28c0,0x0ec0,
//        0x23c0,0x1000,0x27c0,0x2bc0,0x1300,0x2fc0,0x0d00,0x7cc0,
//        0x9a9a,0xcaca,0x3a3a,0xff00,0xa9cc,0x32c0,0x22c0,0x3c00,
//        0x3d00,0x1cc0,0x31c0,0xba00,0x4200,0x4500,0x0ac0,0x2f00,
//        0x0700,0x7dc0,0x0dc0,0x12c0,0x3800,0x2ec0,0x5a5a,0x29c0,
//        0xeaea,0x0cc0,0x0a0a,0x72c0,0x9600,0xa500,0x0056,0xbd00,
//        0x8800
//};
//u_short extension_list[] = {
//        0x0000,0x0100,0x0200,0x0300,0x0400,0x0500,0x0600,0x0700,
//        0x0800,0x0900,0x0a00,0x0b00,0x0c00,0x0d00,0x0e00,0x0f00,
//        0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,0x1600,0x1700,
//        0x1800,0x1900,0x1a00,0x1b00,0x1c00,0x1d00,0x1e00,0x1f00,
//        0x2300,
//        0x2900,0x2a00,0x2b00,0x2c00,0x2d00,0x2e00,0x2f00,0x3000,
//        0x3100,0x3200,0x3300,
//        0x01ff,
//};
///* should be re confirm all the field types */
//u_char compression_method_list[] = {
//        0x00, 0x01, 0x10, 0x11
//};


/* content type */
const u_char CHANGE_CIPHER_SPEC = 0x14;
const u_char ALERT = 0x15;
const u_char HANDSHAKE = 0x16;
const u_char APPLICATION_DATA = 0x17;
const u_char HEARTBEAT = 0x18;

/* handshake type */
const u_char HELLO_REQUEST = 0x00;
const u_char CLIENT_HELLO = 0x01;
const u_char SERVER_HELLO = 0x02;
const u_char HELLO_VERIFY_REQUEST = 0x03;
const u_char NEW_SESSION_TICKET = 0x04;
const u_char END_OF_EARLY_DATA = 0x05;
const u_char HELLO_RETYR_REQUEST = 0x06;
const u_char ENCRYPTED_EXTENSIONS = 0x08;
const u_char CERTIFICATE = 0x0b;
const u_char SERVER_KEY_EXCHANGE = 0x0c;
const u_char CERTIFICATE_REQUEST = 0x0d;
const u_char SERVER_HELLO_DONE = 0x0e;
const u_char CERTIFICATE_VERIFY = 0x0f;
const u_char CLIENT_KEY_EXCHANGE = 0x10;
const u_char FINISHED = 0x14;
const u_char CERTIFICATE_URL = 0x15;
const u_char CERTIFICATE_STATUS = 0x16;
const u_char SUPPLEMENTAL_DATA = 0x17;
const u_char KEY_UPDATE = 0x18;
const u_char COMPRESSED_CERTIFICATE = 0x19;
const u_char MESSAGE_HASH = 0xff;


u_short tls_version_list[] = {
        0x0300, 0x0301, 0x0302, 0x0303
};
u_short tls_version_rev_list[sizeof(tls_version_list)/2];

u_short cipher_suite_list[] = {
        0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
        0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
        0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
        0x0018,0x0019,0x001a,0x001b,
        0x001e,0x001f,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,
        0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,
        0x002e,0x002f,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,
        0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,
        0x003e,0x003f,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,
        0x0046,
        0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,
        0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008a,0x008b,
        0x008c,0x008d,0x008e,0x008f,0x0090,0x0091,0x0092,0x0093,
        0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009a,0x009b,
        0x009c,0x009d,0x009e,0x009f,0x00a0,0x00a1,0x00a2,0x00a3,
        0x00a4,0x00a5,0x00a6,0x00a7,0x00a8,0x00a9,0x00aa,0x00ab,
        0x00ac,0x00ad,0x00ae,0x00af,0x00b0,0x00b1,0x00b2,0x00b3,
        0x00b4,0x00b5,0x00b6,0x00b7,0x00b8,0x00b9,0x00ba,0x00bb,
        0x00bc,0x00bd,0x00be,0x00bf,0x00c0,0x00c1,0x00c2,0x00c3,
        0x00c4,0x00c5,
        0x00ff,
        0x1301,0x1302,0x1303,0x1304,0x1305,
        0x5600,
        0xc001,0xc002,0xc003,0xc004,0xc005,0xc006,0xc007,0xc008,
        0xc009,0xc00a,0xc00b,0xc00c,0xc00d,0xc00e,0xc00f,0xc010,
        0xc011,0xc012,0xc013,0xc014,0xc015,0xc016,0xc017,0xc018,
        0xc019,0xc01a,0xc01b,0xc01c,0xc01d,0xc01e,0xc01f,0xc020,
        0xc021,0xc022,0xc023,0xc024,0xc025,0xc026,0xc027,0xc028,
        0xc029,0xc02a,0xc02b,0xc02c,0xc02d,0xc02e,0xc02f,0xc030,
        0xc031,0xc032,0xc033,0xc034,0xc035,0xc036,0xc037,0xc038,
        0xc039,0xc03a,0xc03b,0xc03c,0xc03d,0xc03e,0xc03f,0xc040,
        0xc041,0xc042,0xc043,0xc044,0xc045,0xc046,0xc047,0xc048,
        0xc049,0xc04a,0xc04b,0xc04c,0xc04d,0xc04e,0xc04f,0xc050,
        0xc051,0xc052,0xc053,0xc054,0xc055,0xc056,0xc057,0xc058,
        0xc059,0xc05a,0xc05b,0xc05c,0xc05d,0xc05e,0xc05f,0xc060,
        0xc061,0xc062,0xc063,0xc064,0xc065,0xc066,0xc067,0xc068,
        0xc069,0xc06a,0xc06b,0xc06c,0xc06d,0xc06e,0xc06f,0xc070,
        0xc071,0xc072,0xc073,0xc074,0xc075,0xc076,0xc077,0xc078,
        0xc079,0xc07a,0xc07b,0xc07c,0xc07d,0xc07e,0xc07f,0xc080,
        0xc081,0xc082,0xc083,0xc084,0xc085,0xc086,0xc087,0xc088,
        0xc089,0xc08a,0xc08b,0xc08c,0xc08d,0xc08e,0xc08f,0xc090,
        0xc091,0xc092,0xc093,0xc094,0xc095,0xc096,0xc097,0xc098,
        0xc099,0xc09a,0xc09b,0xc09c,0xc09d,0xc09e,0xc09f,0xc0a0,
        0xc0a1,0xc0a2,0xc0a3,0xc0a4,0xc0a5,0xc0a6,0xc0a7,0xc0a8,
        0xc0a9,0xc0aa,0xc0ab,0xc0ac,0xc0ad,0xc0ae,0xc0af,0xc0b0,
        0xc0b1,0xc0b2,0xc0b3,
        0xcca8,0xcca9,0xccaa,0xccab,0xccac,0xccad,0xccae,
        0xd001,0xd002,0xd003,
        0xd005
};
u_short cipher_suite_rev_list[sizeof(cipher_suite_list)/2];

u_char compression_method_list[] = {
        0x00, 0x01, 0x40
};
u_char compression_method_rev_list[sizeof(compression_method_list)];

u_short extension_list[] = {
        0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
        0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
        0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
        0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
        0x0023,
        0xc029,0xc02a,0xc02b,0xc02c,0xc02d,0xc02e,0xc02f,0xc030,
        0xc031,0xc032,0xc033,
        0xff01
};
u_short extension_rev_list[sizeof(extension_list)/2];

int cert_version[] ={
        0, 1, 2
};

int cert_extension_nid[] = {
        90, 82, 83, 89, 747, 85, 86, 769, 87, 666, 401, 126, 103, 748, 857, 177, 398
};

char * cert_extension_str[] = {
        "authorityKeyIdentifier", "subjectKeyIdentifier", "keyUsage", "certificatePolicies",
        "policyMappings", "subjectAltName", "issuerAltName", "subjectDirectoryAttributes",
        "basicConstraints", "nameConstraints", "policyConstraints", "extendedKeyUsage",
        "crlDistributionPoints", "inhibitAnyPolicy", "freshestCRL", "authorityInfoAccess",
        "subjectInfoAccess"
};

int cert_key_algorithm_nid[] = {
        6, 116
};
char *cert_key_algorithm_str[] = {
        "rsaEncryption", "dsaEncryption"
};

int cert_signature_algorithm_nid[] = {
        7, 396, 8, 65, 668, 669, 670, 671, 1145, 1146, 1144, 42
};
char *cert_signature_algorithm_str[] = {
        "md2WithRSAEncryption", "md4WithRSAEncryption", "md5WithRSAEncryption", "sha1WithRSAEncryption",
        "sha256WithRSAEncryption", "sha384WithRSAEncryption", "sha512WithRSAEncryption", "sha224WithRSAEncryption",
        "sha512-224WithRSAEncryption", "sha512-256WithRSAEncryption", "sm3WithRSAEncryption", "shaWithRSAEncryption"
};

#endif //ONLINE_MALICIOUS_TRAFFIC_DETECTION_VALUES_H